import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/article/',
    method: 'get',
    params: query
  })
}

export function fetchArticle(id) {
  return request({
    url: '/article/detail',
    method: 'get',
    params: { id }
  })
}

export function createArticle(data) {
  data.content = data.html
  return request({
    url: '/article/create',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  data.content = data.html
  // console.log('@',data)
  return request({
    url: '/article/update',
    method: 'post',
    data
  })
}

export function deleteArticle(data) {
  return request({
    url: '/article/delete',
    method: 'post',
    data:{id:data}
  })
}
